<?php


namespace Tbf\Bundle\YntAuthBundle\Denglu;


use Tbf\Component\Arrays\ArrayFunction;

class DengluSign {
    static function signArray(array $input,$app_secret)
    {
        $input = ArrayFunction::removeNullValue($input);
        unset($input['sign']);
        $input['sign_type'] = 'MD5';
        ksort($input);
        $sig = '';
        foreach($input as $key=>$value) {
            $sig .= $key.'='.$value;
        }
        $sig .= $app_secret;
        $input['sign'] = md5($sig);
        return $input;
    }
}